/**
 * 初始化对象
 * @param obj 要初始化的对象
 * @param defaultValues 默认值
 */
export function initObj(obj:any,defaultValues?:any){
    Object.keys(obj).forEach((key:string)=>{
        var val = obj[key]
        if(!val) return 
        var typeName = obj[key].constructor.name
        switch (typeName) {
            case Number.name:
                obj[key] = 0
                break;
            case Array.name:
                obj[key] = []
                break;
            case Boolean.name:
                obj[key] = false
                break;
            default:
                obj[key] = undefined
                break;
        }
    })
    if(defaultValues){
        Object.assign(obj,defaultValues)
    }
}